<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ include file="datalink.jsp" %>
    <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-utf-8">
        <title>check</title>
        <style>
            #a {
            width:90%;
            height:100%;
            margin-left:5%;
            border: 1px dashed ;
            background-color:rgba(46, 184, 194, 0.397);
            text-align:center;
            }
            body{
                text-align:center;
                background-color:lightblue;
            }
            #ku {
            width:19%;
            height:16%;
            border: 1px dashed ;
            background-color:rgba(46, 184, 194, 0.397);
            text-align:center;
            float: left;
            }
        </style>
        </head>
        <body>
            <div id="a">
                <form method="post" action="">
                <% 
                    class ke{
                        String name;
                        String address;
                        String teacher;
                        ke(){
                            name=null;
                            address=null;
                            teacher=null;
                        }
                    };
                    ke[][] cl=new ke[5][5];
                    for(int i=0;i<=4;i++){
                        for(int j=0;j<=4;j++){
                            cl[i][j]=new ke();
                        }
                    };
                    Statement st = null;
                   Statement ct = null;
                   st = conn.createStatement();
                   ct = conn.createStatement();
                   String sno=request.getParameter("sno");
                   String exes="SELECT * FROM studentclass where sno ='"+sno+"';";
                   String exec=null;
                   ResultSet rs = null;  
                   rs = st.executeQuery(exes);
                   %><div>
                    <div id="ku" style="color: crimson;"><b><%out.print("星期一");%></b></div>
                    <div id="ku" style="color: crimson;"><b><%out.print("星期二");%></b></div>
                    <div id="ku" style="color: crimson;"><b><%out.print("星期三");%></b></div>
                    <div id="ku" style="color: crimson;"><b><%out.print("星期四");%></b></div>
                    <div id="ku" style="color: crimson;"><b><%out.print("星期五");%></b></div>
                </div><%
                   while (rs.next()){
                       String cno=rs.getString(2);
                       exec="SELECT * FROM class where cno ='"+cno+"';";
                       ResultSet cs = null;
                       cs=ct.executeQuery(exec);
                       while(cs.next()){
                            cl[(Integer.valueOf(cs.getString(7))+1)/2-1][Integer.valueOf(cs.getString(6))-1].name=cs.getString(2);
                            cl[(Integer.valueOf(cs.getString(7))+1)/2-1][Integer.valueOf(cs.getString(6))-1].address=cs.getString(3);
                            cl[(Integer.valueOf(cs.getString(7))+1)/2-1][Integer.valueOf(cs.getString(6))-1].teacher=cs.getString(4);
                       }

                       
                   }
                   for(int i=0;i<=4;i++){
                       for(int j=0;j<=4;j++){
                           if(cl[i][j].name!=null){
                                %><div id="ku"><div><%out.print("课程名："+cl[i][j].name);%></div><div><%out.print("上课地点："+cl[i][j].address);%></div><%out.print("老师："+cl[i][j].teacher);%></div><%
                           }
                           else{
                            %><div id="ku">无</div><%
                           }
                       }
                   }
        
                %>
                </form>
                <button onclick="window.location.href='./srzj.jsp'" type="button" id="add" >返回</button>
                </div>
        </body>
        </html>